#include "topHelixes.h"
#include "../framework.h"

TopHelixes::TopHelixes(Rectangle rec)
	:Helixes(rec){
    this->state = TopHelixes::HORIZONTAL;
    this->escaleX=-0.18f;
    this->escaleY=-0.15f;
}

TopHelixes::~TopHelixes(){}

void TopHelixes::draw(){
	Framework& fr = Framework::instance();

	fr.pipeline.pushMatrix();
		fr.pipeline.pushMatrix();
			fr.pipeline.pushMatrix();
				fr.pipeline.escale(0.01f,0.01f);
				fr.pipeline.draw(Pipeline::CIRCLES,this->objVertices.vertices,this->objVertices.nVertices);
			fr.pipeline.popMatrix();
		fr.pipeline.popMatrix();
            fr.pipeline.rotate(-PI/2);
            Helix& helix = dynamic_cast<Helix&>(this->findObject(Helix::name()));
            fr.pipeline.escale(this->escaleX,this->escaleY);
            helix.draw();
		fr.pipeline.pushMatrix();
            fr.pipeline.escale(-1.0f,-1.0f);
            helix.draw();
        fr.pipeline.popMatrix();
	fr.pipeline.popMatrix();
}

void TopHelixes::timeStep(){
	if (this->state==TopHelixes::HORIZONTAL){
			this->escaleX=-0.18f;
			this->escaleY=-0.15f;
	        this->state=TopHelixes::ROTATION;
	    }else{
	    	this->escaleX=-0.2f;
	    	this->escaleY=-0.8f;
	        this->state=TopHelixes::HORIZONTAL;
	    }

}



